const beanUtil = {
  copyProps: function (source, target) {
    for (let sk in source) {
      if (target.hasOwnProperty(sk)) {
        target[sk] = source[sk];
      }
    }
  },
  // 数字类型默认1，因为状态字段一般的正常状态为1
  clearProps: function (o) {
    for (let k in o) {
      if (typeof o[k] == 'number')
        o[k] = 1;
      else
        o[k] = null;
    }
  },
  // json-bigint处理的Long类型id对象转化为string----废弃，用json-bigint自带的string转化
  invertId: function (id) {
    if (typeof id === 'object') {
      let str = "";
      for(let i = 0; i < id.c.length; i++) {
        str += String(id.c[i]);
      }
      return str;
    } else
      return String(id);
  },
};
export default beanUtil;
